package com.wzh.oracle;

import java.sql.Timestamp;
import java.util.Date;

public class OracleTest {
	
	public static void main(String[] args) {
		test1();
	}
	
	
	//2017-06-09 23:36:59.0
	//2017-06-09 23:36:59.0
	public static void test1(){
		
//		Timestamp time=new Timestamp(0);
//		long t = System.currentTimeMillis();// 获得当前系统毫秒数,这个是1970-01-01到现在的毫秒数
//		System.out.println("t = "+t);
//		Date da = new Date(t);
//		System.out.println("da = "+da);
//		long currentTime = da.getTime(); // 即时毫秒数
//		System.out.println("currentTime = "+currentTime);
//		System.out.println("currentTime/1000 = "+currentTime/1000);// 秒数

//		t = 1357872222592; //毫秒数
//		da = 2013-01-11;
//		currentTime = 1357872222592; //毫秒数，currentTime = t
//		currentTime/1000 = 1357872222 ; //秒

		Timestamp scurrtest = new Timestamp(System.currentTimeMillis());
		System.out.println("scurrtest = "+scurrtest);
		long sqlLastTime = scurrtest.getTime();// 直接转换成long
		System.out.println("Timestamp 转换为 long  sqlLastTime = "+sqlLastTime); //毫秒数
		System.out.println("sqlLastTime/1000 = "+sqlLastTime/1000);     // 秒数
		System.out.println("long 转化为 timestamp ========");
		Timestamp timestamp=new Timestamp(sqlLastTime);
		System.out.println(timestamp);
	}

}
